//
//  NetworkingTool.h
//  record_plugin
//
//  Created by zqj on 2024/9/10.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN


@interface NetworkingTool : NSObject

@property (strong, nonatomic) NSString * playerID;
@property (assign, nonatomic) NSInteger  customerId;


+ (instancetype)sharedInstance;

/// 返回人脸识别和语音识别所需token
/// - Parameters:
///   - serverPath: serverPath description
///   - handler: 成功返回token
///   - fail: 请求错误或者失败
- (void)getAuthTokenWithServerPath:(NSString *)serverPath handler:(void(^)(NSString *accessToken))handler failure:(void(^)( NSError * error))fail;


/// 身份证上传
/// - Parameters:
///   - accessToken: 认证token
///   - handler: 返回身份证url
///   - fail: 请求错误或者失败
- (void)uploadIdentityImgWithHandler:(void(^)(NSString *firstImgUrl))handler failure:(void(^)( NSError * error))fail;


/// 获取音视频服务器地址
/// - Parameters:
///   - handler: 返回音视频服务器url
///   - fail: 请求错误或失败
- (void)getAVDServerWithHandler:(void(^)(NSString *avdServerUrl))handler failure:(void(^)( NSError * error))fail;


/// 返回音视频服务器认证token
/// - Parameters:
///   - handler: 音视频token
///   - fail: 请求失败
- (void)getAVDTokenWithHandler:(void(^)(NSString *avdToken))handler failure:(void(^)( NSError * error))fail;


/// 创建tts播放器
/// - Parameters:
///   - roomID: 房间号
///   - handler: 播放器id
///   - fail: 请求错误
- (void)creteTTSPlayer:(NSString *)roomID handler:(void(^)(NSString *playerID))handler failure:(void(^)( NSError * error))fail;


/// 播放tts
/// - Parameters:
///   - ttsUrl: ttsUrl
///   - handler: tts总时长
///   - fail: 请求失败
- (void)playTTS:(NSString *)ttsUrl handler:(void(^)(NSInteger totalTime))handler failure:(void(^)( NSError * error))fail;


/// 停止tts播放器
/// - Parameters:
///   - handler: 成功
///   - fail: 失败
- (void)stopTTSPlayerWithHandler:(void(^)(void))handler failure:(void(^)( NSError * error))fail;


/// 语音转文字asr
/// - Parameters:
///   - path: wav语音文件地址
///   - handler: 成功
///   - fail: 失败
- (void)audio2TextAsr:(NSString *)path handler:(void(^)(NSString *asrTxt))handler failure:(void(^)( NSError * error))fail;


/// 文字转tts
/// - Parameters:
///   - text: 文字
///   - handler: tts 地址
///   - fail: 失败
- (void)text2Tss:(NSString *)text handler:(void(^)(NSString *ttsUrl))handler failure:(void(^)( NSError * error))fail;

/// 加入排队
/// - Parameters:
///   - handler: 成功
///   - fail: 失败
- (void)joinQueue:(NSInteger )productId name:(NSString *)name  handler:(void(^)(NSString *roomId))handler failure:(void(^)( NSError * error))fail;


/// 人脸对比 在框检测 多人脸检测
/// - Parameters:
///   - firstFileUrl: 身份证url
///   - localImg: 本地视频截图
///   - handler: code //200对比通过 500人脸不在框 600多人在框 similarity人脸对比相似度
///   - fail: 失败
- (void)faceDetect:(NSString *)firstFileUrl localImg:(UIImage *)localImg handler:(void(^)(NSInteger code ,double similarity))handler failure:(void(^)( NSError * error))fail;



/// 开启服务器录制
/// - Parameters:
///   - roomID: 房间id
///   - handler: 成功
///   - fail: 失败
- (void)startServerRecord:(NSString *)roomID handler:(void(^)(void))handler failure:(void(^)( NSError * error))fail;


/// 停止服务器录制
/// - Parameters:
///   - handler: 成功
///   - fail: 失败
- (void)stopServerRecordWithHandler:(void(^)(NSString *palyUrl))handler failure:(void(^)( NSError * error))fail;

//0成功/1缺少type/2缺少code/3缺少key/4非法的key/9系统异常
- (void)getTSSListWithCode:(NSString *)code handler:(void(^)(NSMutableArray *ttsArr))handler failure:(void(^)( NSError * error))fail;

///取消请求
- (void)cancleReq;

@end

NS_ASSUME_NONNULL_END
